<?php
	defined('_JEXEC') or die('Retrict Access');
	
	session_start();
	
	$visit	= new visitbs();
	$online	= new onlinebs();
	
	// Khởi tạo session count
	if (!isset($_SESSION["count"]))
	{
		// Tăng số truy cập lên 1
		$visit->Update();
		
		$_SESSION['count'] = session_id();
		$date = getdate();
		$online->sidOnline = session_id();
		$online->timeOut = 120;
		$online->Add();
	}
	else
	{
		$online->sidOnline = session_id();
		$online->timeOut = 120;
		
		$ret_sid = $online->Check();
		
		if($ret_sid == false)
			$online->Add();
		else
			$online->Update();
	}
	
	$ret_vs = $visit->Get();
	$ret_ol = $online->Count();
	$online->Delete();
?>
<li>Lượt xem: <span style="color: red"><?php echo $ret_vs[0]["SoLuocTruyCap"]; ?></span></li>
<li>Đang online: <span style="color: red"><?php echo $ret_ol[0]["numOnline"]; ?></span></li>